/*
 * Copyright (c) 2019.  drakelee.base All rights reserved.
 */

package com.base.components.task.service;

import com.google.common.base.Strings;

/**
 * 广播类型
 *
 * @author <a href="drakelee1221@gmail.com">LiGeng</a>
 * @version 1.0.0, 2017-08-03 15:04
 *
 */
public enum TaskBroadcastType {
  ADD("添加并启动"),
  TRIGGER("立即触发"),
  RESTART("重启"),
  PAUSE("暂停"),
  REBUILD("重构所有"),
  UNLOCK("解除锁定");
  private String desc;

  TaskBroadcastType(String desc) {
    this.desc = desc;
  }

  public String getDesc() {
    return this.desc;
  }

  public static TaskBroadcastType parse(String type){
    if(!Strings.isNullOrEmpty(type)){
      for(TaskBroadcastType t : values()){
        if(t.toString().equalsIgnoreCase(type)){
          return t;
        }
      }
    }
    return null;
  }
}
